with open('a.txt','r',encoding='gbk') as f:
    lines = f.readlines()
    lines2 = [line.replace('\n','')+' #'+str(index)+'\n' for index,line in zip(range(1,len(lines)+1),lines)]

with open('b.txt','w',encoding='utf-8') as f:
    f.writelines(lines2)

